#include "CCBird.h"
#include "CCBirdProduct.h"
#include "BiboFrame.h"
CCBird::CCBird(void)
{
	giveBirthActive = false;
	periodGiveSpcialEgg = 0;
	generateMySelfAPeriodGiveSpcialEggTime();
}
CCBird::~CCBird(void)
{
}
CCBirdProduct* CCBird::giveBirth(int idType){//your wishing give birth theo uoc muon :))
	CCBirdProduct *prod = new CCBirdProduct();
	prod->ProductType(idType);
	return prod->magicMeAsImageYouWant();
}
CCBirdProduct* CCBird::giveBirth(){//give birth naturally
	CCBirdProduct *prod = new CCBirdProduct();
	if(BiboFrame::getRandomNum(10,0)>6 && lifeTime>20){
		prod->ProductType(2);//is chat thai, dung
	}else{
		prod->ProductType(1);//is egg
	}

	/*give special egg*/
	if((int)this->getLifeTime()%periodGiveSpcialEgg==0){
		prod->ProductType(3);
		periodGiveSpcialEgg*=3;
	}
	return prod;
}

void CCBird::generateMySelfAPeriodGiveSpcialEggTime(){
	if(BiboFrame::getRandomNum(10,0)>5){
		periodGiveSpcialEgg = 60;
	}else{
		periodGiveSpcialEgg = 120;
	}
}
